package com.ravi.service;

import com.ravi.dao.CheckAreaDAO;
import com.ravi.entity.CheckArea;
import com.ravi.vo.AreaRoomVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CheckAreaService {

	@Autowired
	private CheckAreaDAO checkAreaDAO;

	/**
	 * 通过id查询AreaRoomVo等一系列信息
	 * @param id
	 * @return
	 */
	public AreaRoomVo getAreaInfoById(Integer id) {
		AreaRoomVo areaRoomVo = checkAreaDAO.getAreaRoomInfoByAreaId(id);
		if (areaRoomVo==null) {
			throw new RuntimeException("找不到检查区!");
		}
		return areaRoomVo;
	}

	public List<CheckArea> getAllCheckAreas() {
		return checkAreaDAO.getAllCheckAreas();
	}
}
